<template>
  <div>
    <h1>用户认证已审核</h1>
    <el-table
        :data="tableData.records"
        stripe
        style="width: 100%">
      <el-table-column
          prop="userName"
          label="用户名"
          width="">
      </el-table-column>
      <el-table-column
          prop="realName"
          label="真实姓名"
          width="">
      </el-table-column>
      <el-table-column
          prop="firm"
          label="公司名称">
      </el-table-column>
      <el-table-column
          prop="sex"
          label="性别"
          width="">
      </el-table-column>
      <el-table-column
          prop="phone"
          label="手机号"
          width="">
      </el-table-column>
      <el-table-column
          prop=""
          label="操作"
          width="">
        <template #default="scope">
          <el-button type="danger" @click="look(scope.row.userId)">查看审核详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
        v-model:current-page="currentPage"
        v-model:page-size="pageSize"
        background
        layout="prev, pager, next, jumper"
        :total="tableData.total"
        @current-change="init"
    />

    <el-dialog
        v-model="showuser"
        title="已审核用户信息"
        width="40%"
    >

      <el-form :model="userObj" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
        <el-form-item label="用户名" prop="userName">
          {{ userObj.userName }}
        </el-form-item>
        <el-form-item label="真实姓名" prop="realName">
          {{ userObj.realName }}
        </el-form-item>
        <el-form-item label="性别" prop="sex">
          {{ userObj.sex }}
        </el-form-item>
        <el-form-item label="手机号" prop="phone">
          {{ userObj.phone }}
        </el-form-item>
        <el-form-item label="公司名称" prop="firm">
          {{ userObj.firm }}
        </el-form-item>
        <el-form-item label="资质证图片">
          <el-image
              style="width: 150px; height: 150px"
              :src="url1"
              :preview-src-list="srcLis1t">
          </el-image>
        </el-form-item>
        <el-form-item label="身份证图片">
          <el-image
              style="width: 150px; height: 150px"
              :src="url2"
              :preview-src-list="srcList2">
          </el-image>
        </el-form-item>
        <el-form-item label="审核状态" prop="firm">
          {{ userObj.audit }}
        </el-form-item>
        <el-form-item label="未通过原因" prop="content">
          {{ userinfo.content }}
        </el-form-item>
        <el-form-item label="发起时间" prop="createDate">
          {{ userinfo.createDate }}
        </el-form-item>
        <el-form-item label="审核时间" prop="updateDate">
          {{ userinfo.updateDate }}
        </el-form-item>
        <el-form-item label="审核人" prop="updateDate">
          {{ userinfo.adminName }}
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="closedialog()">关闭</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      currentPage: 1,
      pageSize: 3,
      tableData: {},
      showuser: false,
      userObj: {},
      userinfo: {},
      url1: '',
      url2: '',
    }
  },
  methods: {
    init(pageNO) {
      this.currentPage = pageNO
      axios.get("/project/user/findByStatus", {
        params: {
          status: 1,
          pageNO: pageNO
        }
      }).then(resp => {
        this.tableData = resp.data
      })
    },
    closedialog() {
      this.showuser = false;
    },
    look(userId) {
      this.showuser = true
      this.url1 = '';
      this.url2 = '';
      this.userObj ={};
      this.userinfo= {};
      axios.get("/project/user/showUserInfo", {
        params: {
          userId
        }
      }).then(resp => {

        this.userObj = resp.data
        console.log(this.userObj)
        this.url1 = this.userObj.aptitudeImg
        this.url2 = this.userObj.idImage
        this.userinfo = this.userObj.userInfo
      })

    }
  },
  mounted() {
    this.init(1)
  }
}
</script>

<style scoped>

</style>